#define _CRT_SECURE_NO_WARNINGS 1
#include "SeqList.h"
<<<<<<< HEAD
void SeqListTest()
{
	SL s;
	//初始化
	SLInit(&s);
	//尾插
	//SLPushBack(&s, 1);
	//SLPushBack(&s, 2);
	//SLPushBack(&s, 3); // 1->2->3
	////头插
	//SLPushFront(&s, 6);
	//SLPushFront(&s, 7);
	SLPushFront(&s, 8);//8->7->6->1->2->3
	////打印
	SLPrint(&s);
	//查找
	int find = SLFind(&s, 3);
	if (find >= 0)
		printf("找到了,下标是:%d\n", find);
	else
		printf("没找到!!!\n");
	//销毁
	SLDestroy(&s);
}

int main()
{
	SeqListTest();
============================================

enum SeqListNumber
{
	EXIT,
	PushFront,
	PushBack,
	PopFront,
	PopBack,
	Insert,
	Erase,
	Find,
	Print
};

void MenuShow()
{
	printf("**************************************************************\n");
	printf("****************1.头部插入数据  2.尾部插入数据****************\n");
	printf("****************3.头部删除数据  4.尾部删除数据****************\n");
	printf("****************5.指定位置插入  6.指定位置删除****************\n");
	printf("****************7.查找指定位置  8.查看表中内容****************\n");
	printf("****************0.退出顺序表    ******************************\n");
}

void SeqListProject()
{
	int input = 0;
	int index = 0;
	int position = 0;
	SeqList s;
	SeqListInit(&s);
	do
	{
		MenuShow();
		printf("请输入序号:");
		scanf("%d", &input);
		switch (input)
		{
		case EXIT:
			printf("退出程序!!!\n");
			break;
		case PushFront:
			printf("请输入头插要插入的数据:");
			scanf("%d", &index);
			SeqListPushFront(&s, index);
			break;
		case PushBack:
			printf("请输入尾插要插入的数据:");
			scanf("%d", &index);
			SeqListPushBack(&s, index);
			break;
		case PopFront:
			SeqListPopFront(&s);
			break;
		case PopBack:
			SeqListPopBack(&s);
			break;
		case Insert:
			printf("请输入要插入数据的位置:");
			scanf("%d", &position);
			printf("请输入要插入的值:");
			scanf("%d", &index);
			SeqListInsert(&s, position, index);
			break;
		case Erase:
			printf("请输入要删除数据的位置:");
			scanf("%d", &position);
			SeqListErase(&s, position);
			break;
		case Find:
			printf("请输入要查找的数据:");
			scanf("%d", &index);
			int find = SeqListFind(&s,index);
			if (find >= 0)
				printf("找到了,下标是:%d\n", find);
			else
				printf("没找到!!!\n");
			break;
		case Print:
			SeqListPrint(&s);
			break;
		}
	} while (input);
	SeqListDestroy(&s);
}

int main()
{
	SeqListProject();
>>>>>>> 1ff24389b2239db6ebe07c1ac03a8a42fed3c12a
	return 0;
}